package entity;

import java.util.List;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import org.hibernate.annotations.ForceDiscriminator;
import org.hibernate.validator.NotNull;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "swotElementType", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("SWOTElement")
@ForceDiscriminator
public class SWOTElement {
	
	@Id
	@GeneratedValue
	private int id;
	
	@NotNull
	private String name;
	
	@NotNull	
	private int relevance;
	
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name="SWOTElement_Perspective", joinColumns=@JoinColumn(name="SWOTElement_id"), inverseJoinColumns=@JoinColumn(name="Perspective_id"))
	private List<BSC_Perspective> perspectives;
	
	@ManyToMany(fetch = FetchType.LAZY)	
	@JoinTable(name="BSCGoal_SWOTElement", joinColumns=@JoinColumn(name="SWOTElement_id"), 
			   inverseJoinColumns=@JoinColumn(name="BSCGoal_id"))	
	private List<BSCGoal> listDerivedBSCGoeal;
	
	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setRelevance(int relevance) {
		this.relevance = relevance;
	}

	public int getRelevance() {
		return relevance;
	}

	public void setListDerivedBSCGoeal(List<BSCGoal> listDerivedBSCGoeal) {
		this.listDerivedBSCGoeal = listDerivedBSCGoeal;
	}

	public List<BSCGoal> getListDerivedBSCGoeal() {
		return listDerivedBSCGoeal;
	}

	public void setPerspectives(List<BSC_Perspective> perspectives) {
		this.perspectives = perspectives;
	}

	public List<BSC_Perspective> getPerspectives() {
		return perspectives;
	}
}
